package com.tfswue.mxj.controller;


import com.tfswue.mxj.service.EventPublisherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class RegestController {
    @Autowired
    private EventPublisherService eventPublisher;
    @PostMapping("/register")
    public ResponseEntity< String> registerUser(
            @RequestParam String userName,
            @RequestParam String email) {


        //业务逻辑处理。。。

        //发布用户注册事件
        eventPublisher.publishUserRegistered(userName, email);

        return ResponseEntity.ok("注册成功！");
    }
}
